<h1>Producenci</h1>
{mainoptions title="Lista"}
		<table cellspacing="0" cellpadding="0" border="0">
			<tr>
				<td>{tables label="Lp. [id]" tid=manufacturer_table o=id}</td>
				<td>{tables label="Nazwa [ilość produktów]" tid=manufacturer_table o=name}</td>
				<th class="noSort"><a href="{url Manufacturer=Add}" class="add">Dodaj</a><div class="sort"><a class="ascendingAct" href="#">&nbsp;</a><a class="descending" href="#">&nbsp;</a></div></th>
			</tr>
			{foreach from=$arrayObjManufacturers item=obj name=manufacturer_table}
			<tr>
				<td>{tables type='lp' tid='manufacturer_table' iteration=$smarty.foreach.manufacturer_table.iteration} [{$obj->getId()}]</td>
				<td>{$obj->getName()} [{$obj->getProductsCount()}]</td>
				<td>
					<a href="{url Manufacturer=edit id=$obj->getId()}" class="edit"> edytuj</a>
					{if $obj->getProductsCount() gt 0}
						<a onclick="alert('Aby usunąć producenta, najpierw należy usunąć wszystkie jego produkty.');return false;" href="#" class="delete"> usuń</a>
					{else}
						<a onclick="if(!confirm('Czy na pewno chcesz usunąć ten element?'))return false;" href="{url Manufacturer=delete id=$obj->getId()}" class="delete"> usuń</a>
					{/if}
				</td>					
			</tr>
			{/foreach}
			<tr class="selAllRow">
				<td colspan="3">
					<div class="pager">
						{tables type='pagination' tid='manufacturer_table' all_count=$c}
						{tables type='on_page' tid='manufacturer_table'}
					</div>
				</td>
			</tr>			
		</table>
{/mainoptions}